module ActiveDirectory
  module Schema
    module Group
      include ActiveDirectory::Schema::Base
      
      def schema
        {
          :cn =>             [ String, :public, nil ],
          :sAMAccountName => [ String, :public, nil ],
          :name =>           [ String, :public, nil ],
          :description =>    [ String, :public, nil ],
          :member =>         [ Array,  :public, nil ],
          :memberOf =>       [ Array,  :public, nil ]
        }
      end

      def schema_system_attributes
        {
          :objectClass => [ 'top', 'group' ]
        }
      end
    
      def primary_identifier_attribute
        'sAMAccountName'
      end
    
      def filter(custom_filter = nil)
        "(&(objectClass=Group)#{custom_filter})"
      end

  
      def self.extended(parent_klass)
        ActiveDirectory::Schema.extend_with_schema(parent_klass)
      end
    end
  end
end
